<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		#btn{
			height: 100px;
			width: 100px;
			background-color: pink;
			display: block;
			text-align: center;
			line-height: 100px;
			border-radius: 50%;
			box-shadow: 1px 1px 10px 3px;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
		}
	</head>

	<body>

	</style>
	<div id="table">

		<h1 style="display:none;">Javascript是前端的霸主</h1>
		<a href="javascript:aaa(0);" id="btn">点我试试</a>
	</div>
	<script>

		
		
		function aaa() {
			//分支 控制 循环
			var yn=confirm('你要显示标题吗？');
			var h1s = document.getElementsByTagName('h1');
			if (yn){//要显示
				//alert("要显示");

				h1s[0].style.display='block';
				h1s[0].style.color='pink';


			}else{//不要显示
				// alert("不显示");
				h1s[0].style.display='none';

			}
		}


	</script>
</body>
</html>